

public class ExpressionListenerHandler extends GoParserBaseListener {

    // GoParser parser;
    // public ExpressionListenerHandler(GoParser parser){
    //     this.parser = parser;
    // }

    private int cnt;
    private String E = "E";
    private String decAssign = " := ";

    private String getVnName(){
        return "E_" + cnt++;
    }
    private String getLastVnName(){
        return "E_" + cnt;
    }

    

    public void exitExpression(GoParser.ExpressionContext ctx) {
        if(ctx.unary_op != null){
            String op = ctx.unary_op.getText();
            // System.out.println(getLastVnName() + decAssign + );
        }
        else if(ctx.mul_op != null){

        }
        else if(ctx.add_op != null){

        }
        else if(ctx.rel_op != null){

        }
    }

    public void exitShortVarDecl(GoParser.ShortVarDeclContext ctx){
        GoParser.IdentifierListContext id_list = ctx.identifierList();
        GoParser.ExpressionListContext expr_list = ctx.expressionList();
        int num = id_list.IDENTIFIER().size();
        for (int i = 0; i < num; i ++){
            System.out.println(id_list.IDENTIFIER(i).getText() + " := " + getVnName());
        }
    }
}
